package pc29;

public class J11Exception {
	public static void main(String[] args){
		
		int j[] = new int[10];
		
		/*System.out.println("보이냐");
		System.out.println(100/0); < 이생키문제
		System.out.println("보이냐");
		
		for(int i=1; i<=10; i++){
			System.out.println(j[i]); < 이생키도문제
		}*/
		
		/*// 예외처리할거다
		System.out.println("보이냐");
		try{
		System.out.println(100/0);
		}
		catch(ArithmeticException ae){
			// ae.printStackTrace();
			System.out.println("0으로 나누면 디짐");
		}
		System.out.println("보이냐");
		
		
		try{
		for(int i=1; i<=10; i++){
			System.out.println(j[i]);
		}
		}
		catch(ArrayIndexOutOfBoundsException aiob){
			System.out.println("배열인덱스초과");
		}
		*/
		
		/*// 다중 catch 문 사용
		try{
			System.out.println(100/0);
			System.out.println(j[100]);
		}
		catch(ArithmeticException ae){
			System.out.println("0으로나누지말라고");
		}
		catch(ArrayIndexOutOfBoundsException aiob){
			System.out.println("배열인덱스초과라니까");	
		}
		*/
		
		// 모든 예외의 조상 - Exception
		try{
			System.out.println(100/0);
			System.out.println(j[100]);
			System.out.println("----");
		}
		catch(Exception ex){
			ex.printStackTrace(); // 오류상세정보출력
			System.out.println("오류가나타났다!!!!!!!!");
		}
		
		
	}
}
